home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / modula2f.zip / DOSDISK.DEF < prev    next >
Text File  |  1992-06-22  |  3KB  |  76 lines

  1. (* DOSdisk  DOS interupt procedures     1992    Chris Harshman
  2.     This module provides DOS disk handling procedures not provided in
  3.     FileSystem, such as setting or getting the current drive or directory. *)
  4.  
  5. DEFINITION MODULE DOSdisk;
  6.  
  7. PROCEDURE SetDrive(drive:CHAR);
  8.     (* Given the letter of the drive, will set that drive to be the current
  9.        disk drive for file handling.  Can use upper or lowwer case letter. *)
  10.  
  11. PROCEDURE GetDrive(VAR drive:CHAR);
  12.     (* Will return the letter of the current disk drive, in upper case. *)
  13.  
  14.     (* Even though in the following procedures, directory is not defined as a
  15.        VAR parameter, I recomend using an array of size one more than the name
  16.        you will be passing.  For example, if you wanted to specify '/DOS'
  17.        use a variable defined as ARRAY [0..4] OF CHAR at least.  This will
  18.        automatically handle DOS's expectation of the name ending in a CHR(0). *)
  19.  
  20. PROCEDURE Mkdir(directory:ARRAY OF CHAR; VAR error:CARDINAL);
  21.     (* Will create the specified directory, and return the errorcode, if any.
  22.        Errorcodes are standard DOS interupt errorcodes and are listed later. *)
  23.  
  24. PROCEDURE Chdir(directory:ARRAY OF CHAR; VAR error:CARDINAL);
  25.     (* Will set the specified directory to become the current directory.
  26.        Returns the errorcode of any. *)
  27.  
  28. PROCEDURE Rmdir(directory:ARRAY OF CHAR; VAR error:CARDINAL);
  29.     (* Will remove the specified directory from disk, as long as it is not the
  30.        current directory and it contains no files or subdirectories. *)
  31.  
  32. PROCEDURE GetDir(VAR directory:ARRAY OF CHAR);
  33.     (* Will return the current directory path. *)
  34.  
  35. PROCEDURE Delete(file:ARRAY OF CHAR; VAR error:CARDINAL);
  36.     (* Will delete the file specified.  The file name must have no wildcards.
  37.        Error will return the DOS errorcode, or 0 if no error. *)
  38.        
  39. PROCEDURE FindFirst(name:ARRAY OF CHAR; attr:CARDINAL; VAR error:CARDINAL);
  40.     (* Will search for the first file found as specified by the name, if any
  41.        are found error will hold 0.  Else, error will hold the DOS errorcode. *)
  42.  
  43. PROCEDURE FindNext(VAR error:CARDINAL);
  44.     (* Will search for the next file, if any left error will hold 0.  Else,
  45.        error holds the DOS errorcode. *)
  46.  
  47. PROCEDURE FindAttr(VAR attr:CARDINAL);
  48.     (* Will return the attribute of the currently found file. *)
  49.  
  50. PROCEDURE FindTime(VAR hour,min,sec:CARDINAL);
  51.     (* Will return the time of the currently found file. *)
  52.  
  53. PROCEDURE FindDate(VAR month,day,year:CARDINAL);
  54.     (* Will return the date of the currently found file. *)
  55.     
  56. PROCEDURE FindLength(VAR len:LONGCARD);
  57.     (* Will return the length of the currently found file. *)
  58.  
  59. PROCEDURE FindName(VAR name:ARRAY OF CHAR);
  60.     (* Will return the name of the currently found file. *)
  61.  
  62. END DOSdisk.
  63.     (* this is a list of DOS errorcodes
  64.         0   no error
  65.         1   invalid function
  66.         2   file not found
  67.         3   path not found
  68.         4   too many open files
  69.         5   access denied (general error)
  70.         6   invalid handle
  71.         15  invalid drive
  72.         16  can't remove current directory
  73.         18  no more files
  74.       other codes 7 to 13 and 17 do exist but are not relevant for these
  75.       procedures. *)
  76.